package edu.bbu.license.client.android.controller;

import edu.bbu.license.client.android.services.file.FileServiceProvider;
import edu.bbu.license.client.android.services.file.worker.FileService;
import edu.bbu.license.client.android.services.transfer.TransferServiceProvider;
import edu.bbu.license.client.android.services.transfer.worker.TransferService;
import edu.bbu.license.client.android.services.user.UserServiceProvider;
import edu.bbu.license.client.android.services.user.worker.AutentificationService;

public abstract class BaseController {	
	
	private static UserServiceProvider userServiceProvider = new UserServiceProvider();
	private static FileServiceProvider fileServiceProvider = new FileServiceProvider();
	private static TransferServiceProvider transferServiceProvider = new TransferServiceProvider();
	
	public AutentificationService getAutentificationService() {
		return userServiceProvider.getAutentificationService();
	}
	
	public FileService getFileService() {
		return fileServiceProvider.getFileService();
	}
	
	public TransferService getTransferService() {
		return transferServiceProvider.getTransferService();
	}
	
	public void executeInNewThread(Runnable runnable) {
		new Thread(runnable).start();
	}
	
	public void doFloodPreventiveSleep(int seconds) {
		try {
			Thread.sleep(seconds * 1000);
		} catch (InterruptedException e) { }
	}
}
